/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved.                             */
/* Open Source Software - may be modified and shared by FRC teams. The code   */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project.                                                               */
/*----------------------------------------------------------------------------*/

package com.nurdrobotics;

import edu.wpi.first.wpilibj.*;

/**
 *
 */
public class Lifter {

    private static SpeedController m_jaguar = null;
    private static boolean m_running = false;

    /*
     * creates a named constant for the speed of the lifter motor. Ideally, this
     * would be a slider in the Driver Station, but all four of these are used.
     */
    private static final double LIFTER_SPEED = 0.5;

    /*
     * This function initializes variables in this class. It should
     * be called exactly once prior to using the class.
     */
    public static boolean init() {
        m_jaguar = Motor.getInstance(Motor.ID_LIFTER);
        if(m_jaguar == null) {
            Dashboard.setLifterStatus("ERR");
            return false;
        }

        return true;
    }

    /*
     * run the stager
     */
    public static void start() {
        m_running = true;
        m_jaguar.set(LIFTER_SPEED);
    }

    /*
     * run the stager (in reverse! which is actually the same as ejecting
     */
    public static void reverse() {
        m_running = true;
        m_jaguar.set(-LIFTER_SPEED);
    }

    /*
     * stop the stager
     */
    public static void stop() {
        m_running = false;
        m_jaguar.set(0);
    }

    /*
     * This routine returns true if the lifter is running, false otherwise
     */

    public static boolean isRunning() {
        return (m_running);
    }
}
